<meta charset="utf-8">
<div class="box box-primary" id="pmpRequires_addModule">
	<form role="form" id="pmpRequires_module_updatename" >
		<div class="box-body">
			<div class="form-group">
				<label>模块名称</label> 
				<input type="text" name="newname" v-model="newname" class="form-control" id="newname" required />
			</div>
			<div class="box-footer">
				<button type="button" class="btn btn-default" v-on:click="cancel">取消</button>
				<button type="button" class="btn btn-info pull-right" v-on:click="updatename">提交</button>
			</div>
		</div>
	</form>
	<script type="text/javascript">
new Vue({
			el : '#pmpRequires_addModule',
			data : {
				id: null,
				newname : null,
				bus : new Vue(),
			},
			mounted : function() {
				var _this=this;
				 _this.id=zfesLayerEditDg.getLayerParam().parentId;
				 _this.newname=zfesLayerEditDg.getLayerParam().name;
			},
			methods : {
				updatename : function() {
					if ($("#pmpRequires_module_updatename").valid()) {
						var _this = this;
						var url = "/pmp/service/pm/pmpRequires/updateModuleName";
						zfesAjax.ajaxTodo(url, {"id":_this.$data.id,"newname":_this.$data.newname},function(data) {
							 var zTree = $.fn.zTree.getZTreeObj("requiresZTree");
							 zTree.reAsyncChildNodes(null,  "refresh", false);
							 setTimeout(function(){ zTree.expandAll(true); }, 1000);
									
									alertSwal.successText(data.message);
									layer.close(layer.index);
									
									
								})
					}
				},
				cancel : function() {
					layer.close(layer.index);
				}
			}
		});
	</script>
</div>
